class Car:
    """
    make：厂家
    model：型号
    year：年份
    odometer：里程数
    """
    def __init__(self, make, model, year):
        self.make = make
        self.model = model
        self.year = year
        self.odometer = 0


    def get_detail(self):
        detail = "Car{make:" + self.make + ", model:" + self.model \
                 + ", year:" + self.year + ", odometer:" + str(
            self.odometer) + "}"
        print(detail)
        return detail

    def read_odometer(self):
        odometer = self.odometer
        print(odometer)
        return odometer

    def driver(self, a):
        """
        驾驶
        :param a: 公里数
        :return:
        """
        self.odometer += a

    def set_odometer(self, odometer):
        self.odometer = odometer


def learn_a():
    your_car = Car("奥迪", "A4", "20240801")
    your_car.get_detail()
    # ①直接修改属性值:对象名.属性 = val
    # 汽车生产完以后需要做十公里的测试
    your_car.odometer = 10
    your_car.get_detail()
    # ②通过方法设置属性值: 对象名.方法()
    # 发现路测实际距离是13公里，但是表显是10公里，此时需要校准历程表
    your_car.set_odometer(13)
    your_car.get_detail()
    # ③通过方法不断增加
    # 驾驶会导致里程表不断增加
    your_car.driver(200)
    your_car.get_detail()


if __name__ == '__main__':
    learn_a()